package com.confidena

import com.confidena.security.Person

class GameCircle {
	static belongsTo = [personGame:PersonGame]
	PersonGame personGameCreated
	Person person
	String email 
	String state
	Date dateCreated
	Date dateEvent

    static constraints = {
		personGameCreated nullable:true
		person nullable:true
    }
	
	String toString() {
		"${person.username}"
	}
	
	def getCircle(){
		if(this.personGameCreated){
			return this.personGameCreated.person
		}
		if(this.person){
			return this.person	
		}	
		return this.email
	}
}
